package com.atguigu.tingshu.account.mapper;

import com.atguigu.tingshu.model.account.UserAccountDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserAccountDetailMapper extends BaseMapper<UserAccountDetail> {

    @Select("select *\n" +
            "   from user_account_detail\n" +
            "   where user_id = #{userId} and left(trade_type,4) = '1201'\n" +
            "   and is_deleted = 0\n" +
            "   order by id desc")
    IPage<UserAccountDetail> findUserRechargePage(@Param("pageParam") IPage<UserAccountDetail> pageParam, @Param("userId") Long userId);

    @Select("select *\n" +
            "   from user_account_detail\n" +
            "   where user_id = #{userId} and left(trade_type,4) = '1204'\n" +
            "   and is_deleted = 0\n" +
            "   order by id desc")
    IPage<UserAccountDetail> selectUserConsumePage(@Param("pageParam") IPage<UserAccountDetail> pageParam, @Param("userId") Long userId);
}
